package com.phs.main.common.utils;

import java.util.Random;

public class SaltUtil {
	/**
	 * 获得盐
	 *
	 * @param n 盐的位数
	 * @return 盐值
	 */
	public static String getSalt(int n) {
		char[] chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_+".toCharArray();
		StringBuilder builder = new StringBuilder();
		for (int i = 0; i < n; i++) {
			char aChar = chars[new Random().nextInt(chars.length)];
			builder.append(aChar);
		}
		return builder.toString();
	}
}
